package masterjava.client.gxt.gxtcharts;

import com.extjs.gxt.charts.client.Chart;
import com.extjs.gxt.ui.client.widget.Component;
import masterjava.client.GxtTestEntryPoint;
import masterjava.common.client.gxt.charts.ChartTabs;
import masterjava.common.client.gxt.charts.ChartType;
import masterjava.common.client.gxt.charts.IChartModel;

import static masterjava.common.client.gxt.charts.ChartType.values;

/**
 * User: gkislin
 * Date: 7/20/11
 */
public class GxtChartsEntryPoint extends GxtTestEntryPoint {
    @Override
    protected Component getContent() {
        return new ChartTabs(values()) {
            @Override
            protected IChartModel createChartModel(final ChartType type) {
                return new IChartModel() {
                    @Override
                    public void setChartModel(Chart chart) {
                        switch (type) {
                            case AREA:
                                GxtChartModelsFactory.setAreaModel(chart);
                                break;
                            case BAR:
                                GxtChartModelsFactory.setBarModel(chart);
                                break;
                            case BAR3D:
                                GxtChartModelsFactory.setBar3DModel(chart);
                                break;
                            case CYLINDER:
                                GxtChartModelsFactory.setCylinderModel(chart);
                                break;
                            case FILLEDBAR:
                                GxtChartModelsFactory.setFilledBarModel(chart);
                                break;
                            case HORIZONTAL:
                                GxtChartModelsFactory.setHorizontalModel(chart);
                                break;
                            case PIE:
                                GxtChartModelsFactory.setPieModel(chart);
                                break;
                            case RADAR:
                                GxtChartModelsFactory.setRadarModel(chart);
                                break;
                            case SKETCH:
                                GxtChartModelsFactory.setSketchModel(chart);
                                break;
                        }
                    }
                };
            }
        };
    }
}
